package fr.vvins.core.user.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import fr.vvins.core.user.entity.Favorite;
@Repository
public interface FavoriteRepository extends CrudRepository<Favorite, Integer> {

	@Query("select f from Favorite f where user.id = ?1")
	List<Favorite> findByUserId(Integer userId);

	@Query("select f from Favorite f where user.id = ?1 and product.id=?2 ")
	List<Favorite> findByProductId(Integer userId, Integer entityId);

	@Query("select f from Favorite f where user.id = ?1 and vigneron.id=?2 ")
	List<Favorite> findByVigneronId(Integer userId, Integer entityId);

		
}
